class Solution(object):
    def majorityElement(self, nums):
        nums.sort()
        l=len(nums)
        return nums[int(l/2)]
x=Solution()
print(x.majorityElement([2,2,1,1,1,2,2]))